<template>
<div class="menu_container">
  <el-menu  :default-active="activeIndex" active-text-color="#ffd04b" class="el-menu-demo" mode="horizontal" @select="handleSelect">
    <el-submenu index="1" class="menu_item">
      <template slot="title">会员管理</template>
      <!--对会员进行增删-->
      <el-menu-item index="1-1" class="children"> <router-link :to="`/menu/checkMember?store_id=${store_id}`">查看会员</router-link></el-menu-item>
      <!--echarts报表-->
      <el-menu-item index="1-2" class="children"><router-link :to="`/menu/memberManage?store_id=${store_id}`">会员统计</router-link></el-menu-item>
    </el-submenu>
    <el-submenu index="2" class="menu_item"><template slot="title">订单管理</template>
      <el-menu-item index="2-1" class="children"><router-link :to="`/menu/orderList?store_id=${store_id}`">订单列表</router-link></el-menu-item>
      <el-menu-item index="2-2" class="children"><router-link :to="`/menu/orderHistory?store_id=${store_id}`">历史订单</router-link></el-menu-item>
    </el-submenu>
    <!-- <el-menu-item index="3" class="menu_item"><router-link to="goodManage">商品管理</router-link></el-menu-item> -->
    <el-submenu index="3" class="menu_item"><template slot="title">商品管理</template>
      <el-menu-item index="3-1" class="children"><router-link :to="`/menu/addGood?store_id=${store_id}`">添加商品</router-link></el-menu-item>
      <el-menu-item index="3-2" class="children"><router-link :to="`/menu/EditGood?store_id=${store_id}`">编辑商品</router-link></el-menu-item>
    </el-submenu>
    <el-submenu index="4" class="menu_item">
      <template slot="title"> 个人中心</template>
      <el-menu-item index="4-1"><router-link :to="`/menu/accountManage?store_id=${store_id}`">账户管理</router-link></el-menu-item>
      <el-menu-item index="4-2"><router-link :to="`/menu/storeManage?store_id=${store_id}`">店铺管理</router-link></el-menu-item>
      <el-menu-item index="4-3" class="children" @click="logout">退出登录</el-menu-item>
    </el-submenu>
    <el-menu-item index="5" @click="fff" class="menu_item Contact">联系客服</el-menu-item>
  </el-menu>
  <router-view></router-view>
</div>
</template>

<script>

export default {
  name: 'Menu',
  data () {
    return {
      activeIndex: '1',
      store_id: '2'
    }
  },
  created () {
    this.store_id = this.$route.query.store_id
    // console.log(this.store_id)
    // console.log(this.$route.query.store_id)
  },
  methods: {
    handleSelect (key, keyPath) {
      console.log(key, keyPath)
    },
    fff () {
      this.$alert('12345678910', '客服电话', {
        confirmButtonText: '确定'
      })
    },
    logout () {
      this.$confirm('是否要退出账号', '温馨提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '退出成功'
        })
        this.$router.push('/')
      }).catch(() => {
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.el-menu-demo{
  margin-left: 10%;
}
.menu_item{
  margin: 0 1%;
}
.Contact{
  margin-left: 50%;
  font-size: 13px;
}
.router-link-active{
  color: #ffd04b;
    text-decoration: none;
}
a {
    text-decoration: none;
    color: gray;
}
.menu_container{
}
</style>
